package com.antu.first.enums;

/**
 * IndentService层调用的枚举类型
 * Created by Administrator on 2018/3/5.
 */
public enum IndentStateEnum {

    SUCCESS(1,"下单成功！"),ERROR(-1,"操作失败"),IS_LAST_PAGE(2,"已经是最后一页了！"),EMPTY_LIST(3,"您目前没有订单信息！"),
    DIFF_CODE(-101,"凭证码与订单号不匹配！"),LOADING(6,"正在加载中...");

    private int state;

    private String stateInfo;

    public int getState() {
        return state;
    }

    public String getStateInfo() {
        return stateInfo;
    }

    IndentStateEnum(int state, String stateInfo) {

        this.state = state;
        this.stateInfo = stateInfo;
    }

    public static IndentStateEnum stateOf(int index){
        for(IndentStateEnum state:values()){
            if(state.getState()==index){
                return state;
            }
        }
        return null;
    }
}
